# -*- coding: utf-8 -*-
# @Author: Zach-Pineappleman
# @E-mail: 354399824@qq.com
# @Date:   2025-03-13 21:17:39
# @File_name:behavior_visualizer.py
# @Last Modified by:   Zach-Pineappleman
# @Last Modified time: 2025-03-13 21:18:58

# behavior_visualizer.py
# 行为数据的可视化，折线图和饼图。

import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure

class BehaviorVisualizer:
    def __init__(self, parent_frame):
        self.parent_frame = parent_frame
        self.behavior_map = {
            "1": "专注工作",
            "2": "吃东西",
            "3": "喝水",
            "4": "喝饮料",
            "5": "玩手机",
            "6": "睡觉",
            "7": "其他"
        }
        self.setup_charts()

    def setup_charts(self):
        self.line_fig = Figure(figsize=(7, 3.8), dpi=100)
        self.line_ax = self.line_fig.add_subplot(111)
        self.line_canvas = FigureCanvasTkAgg(self.line_fig, master=self.parent_frame)
        self.line_canvas.draw()
        self.line_canvas.get_tk_widget().pack(fill="both", expand=True)

    def update_line_chart(self):
        self.line_ax.clear()
        self.line_ax.plot([1, 2, 3], [4, 5, 6])  # 示例数据
        self.line_canvas.draw()